program DeleleToAnd;

{$APPTYPE CONSOLE}


type
  pelement=^element;
  element=record
    value: integer;
    next: pelement;
  end;

procedure DeleteFromAnd(var head: pelement);

var
current: pelement;
  begin
    current:=head;
    while (current^.next<>nil) do
    begin
      new(current);
      current:=current^.next;
    end;
    dispose(current^.next^.next);
    new(current^.next);
    current^.next:=nil;
  end;

var
  n, i: integer;
  fin: textFile;
  head: pelement;

begin
  assign(fin, 'input.txt');
  reset(fin);
  read(fin, n);
  for i:=0 to n-1 do
  begin
    new(head);
    read(fin,head^.value);
    head:=head^.next;
    if (i=n-1) then
      head:=nil;
  end;
  DeleteFromAnd(head);
  readln;
  readln;
  readln;
  readln;
end.
